//
//  ScheduleDBService.m
//  NJUSTHelper
//
//  Created by 郑越辉 on 2017/9/19.
//  Copyright © 2017年 njust. All rights reserved.
//

#import "ScheduleDBService.h"

@implementation ScheduleDBService
/* 清空对应用户的课表 */
+(NSInteger)removeAllSchedule4UserId:(NSString *)userId{
    if([userId length] == 0) {
        return 0;
    }
    
    return [[DataBase sharedDataBase] removeAllSchedule4UserId:userId];
}
/* 课表写入数据库 */
+(NSInteger)addSchedulesToDataBaseWithModel:(NSMutableArray *)scheduleArray{
    if([scheduleArray count] == 0) {
        return 0;
    }
    return [[DataBase sharedDataBase]addSchedulesWithArray:scheduleArray];
}
/* 获取用户的课表 */
+(NSMutableArray *)getAllScheduleByUserId:(NSString *)userId{
    if([userId length] == 0) {
        return nil;
    }
    return [[DataBase sharedDataBase] getAllScheduleByUserId:userId];
}
+(NSMutableArray *)getScheduleByWeekDay:(NSInteger)weekDay UserId:(NSString *)userId{
    if([userId length] == 0 || weekDay < 0 || weekDay > 6) {
        return nil;
    }
    return [[DataBase sharedDataBase] getScheduleByWeekDay:weekDay UserId:userId];
}

@end
